﻿/*                              
   Copyright 2011 Nils Kopal, Christopher Krüger, Simone Sauer, Dennis Nolte, Uni Duisburg-Essen

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sharebert.SearchLibrary.Interfaces;

namespace Sharebert.SearchLibrary
{
    /// <summary>
    /// Used by the server when a client offers files.
    /// </summary>
    public class OfferedFilesEventArgs : EventArgs
    {
        public OfferedFilesEventArgs(IClientHandler client, FileOfferList fileOffer)
        {
            this.Client = client;
            this.FileOffer = fileOffer;
        }

        public IClientHandler Client { get; set; }

        public FileOfferList FileOffer { get; set; }
    }

    /// <summary>
    /// Used by the server when a client searches for files.
    /// </summary>
    public class SearchReceivedEventArgs : EventArgs
    {
        public SearchReceivedEventArgs(IClientHandler client, string regEx)
        {
            this.Client = client;
            this.RegEx = regEx;
        }

        public IClientHandler Client { get; set; }

        public string RegEx { get; set; }
    }

    /// <summary>
    /// Used by the client when the server answered a search request.
    /// </summary>
    public class SearchResultEventArgs : EventArgs
    {
        public SearchResultEventArgs(SearchResult[] results)
        {
            this.ResultList = results;
        }

        public SearchResult[] ResultList { get; set; }
    }

    /// <summary>
    /// A new messages has been received.
    /// </summary>
    public class MessageReceivedEventArgs : EventArgs
    {
        public MessageReceivedEventArgs(IMessage message)
        {
            this.Message = message;
        }

        public IMessage Message { get; set; }
    }

    /// <summary>
    /// A new connection has been established.
    /// </summary>
    public class ConnectionEventArgs : EventArgs
    {
        public ConnectionEventArgs(IConnection conn)
        {
            this.Connection = conn;
        }

        public IConnection Connection { get; set; }
    }

}
